# -*- coding: utf-8 -*-
"""
@Time ： 2021/12/5 20:58
@Auth ： Mr. William 1052949192
@Company ：特斯汀学院 @testingedu.com.cn
@Function ：请输入模块功能描述
"""
# This sample code uses the Appium python client
# pip install Appium-Python-Client
# Then you can paste this into a file and simply run with Python
import time

from appium import webdriver

caps = {}
caps["platformName"] = "Android"
caps["deviceName"] = "127.0.0.1:7555"
caps["appPackage"] = "com.android.browser"
caps["appActivity"] = ".BrowserActivity"
caps["noReset"] = "true"
caps["ensureWebviewsHavePages"] = True

driver = webdriver.Remote("http://localhost:4723/wd/hub", caps)
driver.implicitly_wait(10)

el1 = driver.find_element_by_id("com.android.browser:id/url")
el1.click()
el1.send_keys("m.baidu.com")
time.sleep(1)
driver.keyevent(66)

els3 = driver.find_elements_by_xpath("//*[@resource-id=\"index-kw\"]")
els3[0].send_keys("特斯汀学院")

driver.quit()